Ext.define('Admin.view.gooutQuery.GooutQueryGrid', { //1.修改文件路径
    extend: 'Ext.grid.Panel', //2.继承的组件类型
    //3.重写继承组件的属性：
    xtype: 'gooutQueryGrid',
    title: '<b>外出申请查询</b>',
    id: 'gooutQueryGrid',
    bind: '{gooutQueryLists}',

    selModel: Ext.create('Ext.selection.CheckboxModel'),
    listeners: {
        itemdblclick: function (me, record, item, index, e, eOpts) {
            var selModel = this.getSelectionModel();
            if (selModel.hasSelection()) {
                var record = selModel.getSelection()[0];
                var gooutWindow = Ext.widget('gooutSAWindow', {
                    title: "查看外出申请信息",
                    items: {
                        xtype: 'gooutReadForm'
                    },

                });
                gooutWindow.disabled = true;
                gooutWindow.down('form').getForm().loadRecord(record);
            }
        }
    },
    columns: [
        {
            text: '员工工号',
            sortable: true,
            dataIndex: 'number',
            width: 120
        },
        {
            text: '姓名',
            sortable: true,
            dataIndex: 'name',
            width: 120
        },
        {
            text: '外出日期',
            sortable: true,
            dataIndex: 'goOutDate',
            width: 100,
            renderer: Ext.util.Format.dateRenderer('Y/m/d')
        },
        {
            text: '外出时间',
            sortable: true,
            dataIndex: 'goOutTime',
            width: 100,

        },

        {
            text: '外出原因',
            sortable: true,
            dataIndex: 'reason',
            width: 125
        }
        ,
        {
            text: '是否用车',
            sortable: true,
            dataIndex: 'car',
            width: 125,
        },
        {
            text: '职位',
            sortable: true,
            dataIndex: 'job',
            width: 125
        },
        {
            text: '部门',
            sortable: true,
            dataIndex: 'dept',
            width: 125
        },
        {
            text: '申请状态',
            sortable: true,
            dataIndex: 'applyState',
            width: 100
        }],
    dockedItems: {
        xtype: 'toolbar',
        dock: 'top',

        items: [{
                xtype: 'combobox',
                reference: 'gooutGridSearchField', //查询条件下拉列表
                store: Ext.create('Ext.data.Store', {
                    fields: ['value', 'name'],
                    data: [ //查询条件字段名和展示名
                        {
                            "value": 'name',
                            "name": '姓名'
                    },
                        {
                            "value": 'dept',
                            "name": '部门'
                    },
                        {
                            "value": 'number',
                            "name": '员工工号'
                    }
                ]
                }),
                mode: 'local',
                editable: false,
                allowBlank: false,
                queryMode: 'local',
                valueField: 'value',
                displayField: 'name',
                value: 'name' //默认显示data属性中的 用户名
        }, {
                xtype: 'textfield',
                reference: 'gooutGridSearchText' //查询值文本框
        },
            {
                xtype: 'datefield',
                fieldLabel: 'Start Time',
                name: 'startTime',
                format: 'Y-m-d',
                reference: 'gooutSearchForm-startTime'
        }, {
                xtype: 'datefield',
                fieldLabel: 'End Time',
                name: 'endTime',
                format: 'Y-m-d',
                reference: 'gooutSearchForm-endTime'
        },
            {
                text: '查找',
                listeners: {
                    click: 'gooutGridPanelSearch' //快捷查询按钮
                }
        }, {
                text: '导出',
                listeners: {
                    click: 'gooutExporterExcel'
                }
        }]

    },
    bbar: Ext.create('Ext.PagingToolbar', {
        bind: '{gooutQueryLists}',
        displayInfo: true,
        displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
        emptyMsg: "没有任何数据",

    })


})
